package com.wiwf.model.mapper.config;

import com.gitee.fastmybatis.core.FastmybatisConfig;
import com.gitee.fastmybatis.core.support.DateFillInsert;
import com.gitee.fastmybatis.core.support.DateFillUpdate;
import com.wiwf.model.utils.DataSourceUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

/**
 * @author kehui
 */
@Configuration(proxyBeanMethods = false)
public class FastMybatisBean {

    @Bean
    FastmybatisConfig fastmybatisConfig() {
        FastmybatisConfig config = new FastmybatisConfig();

        config.setCamel2underline(true);
        config.setFills(Arrays.asList(
                new DateFillInsert(DataSourceUtil.DB_INSTALL_DATE_COLUMN_NAME),
                new DateFillUpdate(DataSourceUtil.DB_UPDATE_DATE_COLUMN_NAME)));

        return config;
    }

}
